// [[ OnflowGenerator Entity UUID: 1f32c1d07afa449d8081cfce3b85a22d ]]
package com.itdct.onflow.system.menu.entity

import com.baomidou.mybatisplus.annotation.TableName
import com.itdct.onflow.core.annotation.Column
import com.itdct.onflow.core.annotation.ColumnRelateDict
import com.itdct.onflow.core.annotation.ColumnRelateId
import com.itdct.onflow.core.annotation.TableDescription
import com.itdct.onflow.core.entity.BaseUserEntity

/**
 * @author Zhouwx
 * @date 2025/8/21 19:50:30
 * @version 1.0
 * @description
 */
@TableDescription("系统菜单")
@TableName("sys_menu")
class SysMenuEntity : BaseUserEntity() {
    @Column(comment = "显示菜单名称", nullable = false, length = 100, sort = 10, forSelect = true)
    var title = ""

    @Column(comment = "前端模块名称", nullable = false, length = 100, unique = true, sort = 20, forSelect = true)
    var name = ""

    @Column(comment = "前端组件名称", nullable = true, length = 200, sort = 30)
    var component = ""

    @ColumnRelateId(targetClass = SysMenuEntity::class, targetFieldName = "title")
    @Column(comment = "父级菜单ID", nullable = false, indexed = true, sort = 40)
    var parentId = 0L

    @Column(comment = "父级菜单ID路径", length = 2000, sort = 50)
    var idPath = ""

    @Column(comment = "排序（越小排越前）", nullable = false, defaultValue = "100", sort = 60)
    var orderNum = 100

    @Column(comment = "图标", length = 500, nullable = true, sort = 70)
    var icon: String? = null

    @Column(comment = "是否隐藏菜单", nullable = false, defaultValue = "0", sort = 80)
    var hiddenMenu = false

    @Column(comment = "是否隐藏顶部标签", nullable = false, defaultValue = "0", sort = 90)
    var hiddenTag = false

    @Column(comment = "是否启用", nullable = false, defaultValue = "1", sort = 100)
    var enable = true

    @Column(comment = "是否可跳转", nullable = false, defaultValue = "1", sort = 110)
    var canTo = true

    @Column(comment = "是否可以无权限跳转", nullable = false, defaultValue = "0", sort = 120)
    var noPermission = false

    @ColumnRelateDict(dictCode = "platformType")
    @Column(comment = "平台类型", nullable = false, length = 100, defaultValue = "onflow-backend", indexed = true, sort = 130)
    var platformType = ""

    @Column(comment = "备注", length = 500, sort = 500)
    var remark: String? = null

    // TODO: Zhouwx: 2025/9/24 增加拼音和拼音首字母，以及按照菜单查询

}